home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
021-030
/
amok22
/
bigsets
/
bigsets.def
next >
Wrap
Text File
|
1993-11-04
|
3KB
|
85 lines
(**********************************************************************
:Program. BigSets.def
:Contents. Generic data type: SETs with up to 65335 elements (bits)
:Author. Nicolas Benezan [bne]
:Address. Postwiesenstr. 2, 7000 Stuttgart 60, Germany
:Phone. (0)711 / 33 36 79
:Copyright. Public Domain
:Language. Modula-2
:Translator. M2Amiga AMSoft V3.2d
:Imports. TaskMemory [bne]
:History. V1.0 [bne] 30.Jan.1989 (PC version)
:History. V1.1 [bne] 02.Jul.1989 (Amiga version)
**********************************************************************)
DEFINITION MODULE BigSets;
FROM SYSTEM IMPORT ADDRESS;
TYPE
BigSet; (* opaque data type: *)
(* SET OF [0..n], <n> within the range [1..MAX(CARDINAL)] *)
VAR
BigSetsAllocProc:PROCEDURE(VAR ADDRESS, LONGINT);
BigSetsDeallocProc:PROCEDURE(VAR ADDRESS);
(* defaults: TaskMemory.Allocate, TaskMemory.Deallocate *)
PROCEDURE CreateBigSet(VAR Set: BigSet;
NumElements: CARDINAL): BOOLEAN;
(*:Input. Set: an uninitialised (or discarded) BigSet
:Output. Set: initialised BigSet
:Input. NumElements: the number of elements this set should have
:Result. FALSE if an error occured, otherwise TRUE
:Semantic.Allocates memory for the Bigset and prepares it for further
:Semantic.use. The new BigSet has all bits clear (excluded), if
:Semantic.<BigSetsAllocProc> does clear allocated memory (default).
:Note. Do not perform any operation on uninitialised BigSets
*)
PROCEDURE DiscardBigSet(VAR Set: BigSet);
(*:Input. Set: initialised BigSet
:Output. Set: discarded BigSet
:Semantic.Removes the whole BigSet from memory.
:Note. After DiscardBigSet(Set) no operation is allowed on <Set>
*)
PROCEDURE Include(Set: BigSet;
Bit: CARDINAL);
(*:Input. Set: properly initialised BigSet
:Input. Bit: Element (bit) to be included in <Set>
:Semantic.Includes an element (same as INCL(BITSET,Bit) for BigSets)
*)
PROCEDURE Exclude(Set: BigSet;
Bit: CARDINAL);
(*:Input. Set: properly initialised BigSet
:Input. Bit: Element (bit) to be excluded out of <Set>
:Semantic.Excludes an element (same as EXCL(BITSET,Bit) for BigSets)
*)
PROCEDURE BitInSet(Set: BigSet;
Bit: CARDINAL): BOOLEAN;
(*:Input. Set: properly initialised BigSet
:Input. Bit: Element to be tested
:Result. TRUE if <Bit> is included in <Set>, otherwise FALSE
:Note. same as (Bit IN Set) for BigSets
*)
PROCEDURE FindNextClear( Set: BigSet;
VAR Bit: CARDINAL): BOOLEAN;
(*:Input. Set: properly initialised BigSet
:Input. Bit: where to start searching
:Output. Bit: next clear (excluded) bit (if any)
:Result. TRUE, if a clear bit was found
*)
END BigSets.